import Vue from 'vue'
import App from './App.vue'
//引入路由
import router from "@/router";

//引入Vuex store
import store from '@/store/index'

//引入mock
import '@/mock/mockServe'

//导入轮播图css样式
import 'swiper/css/swiper.css'

Vue.config.productionTip = false
//注册 TypeNav为全局组件
import TpyeNav from '@/components/TypeNav/index'
Vue.component(TpyeNav.name,TpyeNav)
//注册 Carsouel轮播组件为全局组件
import Carsouel from '@/components/Carsouel/index'
Vue.use(Carsouel.name,Carsouel)
//注册Pagination分页器组件为全局组件
import Pagination from '@/components/Pagination/index'
Vue.use(Pagination.name,Pagination)

//导入全部的api接口
import * as API from '@/api'

//按需引入element-ui
import {Button, MessageBox} from 'element-ui';
Vue.use(Button);
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
// Vue.component(Button.name, Button);
// Vue.component(Select.name, Select);

//引入vue-lazyload,图片懒加载
import VueLazyLoad from 'vue-lazyload'
import lazyloadImg from '@/assets/images/img.gif'
Vue.use(VueLazyLoad,{
  loading:lazyloadImg
})

//导入veevalidate插件
import '@/plugins/validate'

new Vue({
  render: h => h(App),
  //定义全局事件总线
  beforeCreate() {
    //引入全局事件总线
    Vue.prototype.$bus=this;
    //引入所有api接口
    Vue.prototype.$API=API;

  },
  //在入口文件中注册路由器
  router,
  //注册Vuex store ，注册之后vm中会多一个属性，$store
  store
}).$mount('#app')
